<?php
/**
 * Joomla! 1.5 component eventcalendar
 *
 * @version $Id: router.php 2010-10-01 08:17:29 svn $
 * @author Pasi Lampinen
 * @package Joomla
 * @subpackage eventcalendar
 * @license GNU/GPL
 *
 * Tapahtumakalenteri Joomlaan geolokaatiolla
 *
 * This component file was created using the Joomla Component Creator by Not Web Design
 * http://www.notwebdesign.com/joomla_component_creator/
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

/*
 * Function to convert a system URL to a SEF URL
 */
function EventcalendarBuildRoute(&$query) {
	$segments = array();
	if (isset($query['view'])) {
		$segments[] = $query['view'];
		unset($query['view']);
	}
	if( isset($query['task']) )
    {
      $segments[] = $query['task'];
      unset( $query['task'] );
    };
	
	if( isset($query['id']) )
    {
      $segments[] = $query['id'];
      unset( $query['id'] );
    };
	


	return $segments;
}
/*
 * Function to convert a SEF URL back to a system URL
 */
function EventcalendarParseRoute($segments) {

	$vars = array();
	//$vars['view'] = 'eventcalendar';
	switch($segments[0])
       {
            case 'eventcalendar':
                    $vars['view'] = 'eventcalendar';
                    break;
            case 'month':
					$vars['view'] = 'month';
                    break;
			case 'tallennatapahtuma':		 
					$vars['view'] = 'tallennatapahtuma';
                    break;	
			case 'showevent':							
                    $vars['view'] = 'showevent';
                    $id = explode( ':', $segments[1] );
                    $vars['id'] = (int) $id[0];
                    break;
			case 'showImage':							
                    $vars['task'] = 'showImage';
                    $id = explode( ':', $segments[1] );
                    $vars['id'] = (int) $id[0];
                    break;
			case 'showImageThumb':
			        $vars['task'] = 'showImageThumb';
                    $id = explode( ':', $segments[1] );
                    $vars['id'] = (int) $id[0];
                    break;
       }
	
	

	
	
	return $vars;
	//return;
}